@FunctionalInterface
interface Action<T>{
    void execute(T t);
}
public class Test11_fucntion {
    public static void main(String[] args) {
        Action action3=new MyAction();
        action3.execute("haha");
        //匿名内部类
        Action acttion4=new Action() {
            @Override
            public void execute(Object o) {
                System.out.println(0);
            }
        };
        acttion4.execute("你好啊");
        //lambda语法
        Action action2=(t)->{
            System.out.println(t);
        };
        action2.execute("bye");
        //直接绑定
        Action action=System.out::println;
        action.execute("Hello World");
        //作为参数组
        test(System.out::println,"Hello World");
    }
    static void test(Action action,String str){
        action.execute(str);
    }
}
class MyAction implements Action{

    @Override
    public void execute(Object o) {
        System.out.println(o);
    }
}